﻿using System;

namespace diantou.dataModel
{
    /// <summary>
    /// 支付相关产品
    /// </summary>
    [fastCSharp.emit.jsonSerialize(IsAllMember = true)]
    [fastCSharp.emit.jsonParse(IsAllMember = true)]
    [fastCSharp.emit.dataSerialize(IsReferenceMember = false, IsMemberMap = false)]
    [fastCSharp.code.cSharp.sqlModel]
    public partial class payProduct
    {
        /// <summary>
        /// 产品标识
        /// </summary>
        [fastCSharp.code.cSharp.webView.outputAjax]
        public int Id;
        /// <summary>
        /// 价格(分)
        /// </summary>
        public int Price;
        /// <summary>
        /// 产品名称
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 32)]
        public string Name = string.Empty;
        /// <summary>
        /// 商品详情
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 8192)]
        public string Detail = string.Empty;
        /// <summary>
        /// 产品类型
        /// </summary>
        sealed class productTypeAttribute : Attribute
        {
            /// <summary>
            /// 回调地址
            /// </summary>
            public string NotifyUrl;
            /// <summary>
            /// 发起请求的服务器IP地址
            /// </summary>
            public string NativeIp;
        }
        /// <summary>
        /// 产品类型
        /// </summary>
        public enum productType : byte
        {
            /// <summary>
            /// 未知
            /// </summary>
            Unknown,
            /// <summary>
            /// 用户绑定
            /// </summary>
            [productType(NotifyUrl = "https://www.51nod.com/weixin/pay/notify", NativeIp = "61.136.60.185")]
            WeixinUser,
            /// <summary>
            /// 微信支付点头盾
            /// </summary>
            [productType(NotifyUrl = "https://www.51nod.com/weixin/pay/notify", NativeIp = "61.136.60.185")]
            WeixinNod
        }
        /// <summary>
        /// 产品类型
        /// </summary>
        public productType Type;

        /// <summary>
        /// 回调地址
        /// </summary>
        public string NotifyUrl
        {
            get
            {
                return fastCSharp.Enum<productType, productTypeAttribute>.Array((int)(byte)Type).NotifyUrl;
            }
        }
        /// <summary>
        /// 发起请求的服务器IP地址
        /// </summary>
        public string NativeIp
        {
            get
            {
                return fastCSharp.Enum<productType, productTypeAttribute>.Array((int)(byte)Type).NativeIp;
            }
        }
    }
}
